/**
 * User: Paulo Fournier
 * Date: 12-08-2013
 * Driver data model
 */

Ext.define('Mobile-app.model.Driver', {
    extend: 'Ext.data.Model',

    config: {
        autoLoad: false,
        fields: [
            //driversForUserId
            {name: 'idDriver',                      type: 'int',        filterable: true},
            {name: 'internalNumber',                type: 'string',     filterable: true},
            {name: 'name',                          type: 'string',     filterable: true},
            {name: 'tag',                           type: 'string',     filterable: true},
            {name: 'cardNumber',                    type: 'string',     filterable: true},
            {name: 'position',                      type: 'int'},
            {name: 'state',                         type: 'int'},
            {name: 'vehicle',                       type: 'int',        filterable: true},
            {name: 'lastDailyRest',                 type: 'int'},
            {name: 'lastWeeklyRest',                type: 'int'},
            {name: 'reducedNumberOfRests',          type: 'int'},
            {name: 'numberOfExtendedRestPeriods',   type: 'int'},
            {name: 'drivingTimeCurrentJourney',     type: 'int'},
            {name: 'drivingTimeCurrentWeek',        type: 'int'},
            {name: 'drivingTimeCurrentForthnight',  type: 'int'},
            {name: 'drivingLeft',                   type: 'int'},
            {name: 'mobileReference',               type: 'string',     filterable: true},
            //driverDetail
            {name: 'station',                       type: 'string'},
            {name: 'emissionState',                 type: 'string'},
            {name: 'emissionDate',                  type: 'date',   dateFormat: 'Y-m-d H:i:s'},
            {name: 'validationDate',                type: 'date',   dateFormat: 'Y-m-d H:i:s'},
            {name: 'beginningOfActivity',           type: 'date',   dateFormat: 'Y-m-d H:i:s'},
            {name: 'endOfActivity',                 type: 'date',   dateFormat: 'Y-m-d H:i:s'},
            {name: 'personalContact',               type: 'string'},
            {name: 'companyContact',                type: 'string'},
            {name: 'email',                         type: 'string'}

        ],
        proxy: {
            type: 'ajax',
            url: 'app/php/public/driver.request.php',
            reader: {
                type: 'json'
            }
        }
    }

})